# import subprocess
# import sys
# import threading
# from multiprocessing import Process
# from time import sleep
#
# import flask,json
#
# sys.path.append(r'C:\Users\Jaina\jaina-home')
# from main.link.dbLink import selectSSHHost
#
#
# def after_request(response):
#     response.headers['Access-Control-Allow-Origin'] = '*'
#     response.headers['Access-Control-Allow-Methods'] = 'PUT,GET,POST,DELETE'
#     response.headers['Access-Control-Allow-Headers'] = 'Content-Type,Authorization'
#     return response
#
# api = flask.Flask(__name__)
#
# #消除浏览器 提示：Access to XMLHttpRequest at 'http://127.0.0.1:8888/jaina' from origin 'http://localhost:63342' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
# api.after_request(after_request)
#
# @api.route('/test',methods=['post'])
# #实时命令接口
# def test():
#     go = flask.request.values.get('go')
#     if go == "go":
#         def go():
#             pythonHome="C:\\Users\\Jaina\\AppData\\Local\\Programs\\Python\\Python39\\python.exe"
#             sshDB=pythonHome +" C:\\Users\\Jaina\\jaina-home\\main\\socket\\selectSSH.py"
#             # sshDB=pythonHome +" -V"
#             OutPictures = subprocess.Popen(sshDB,shell=True,stdout=subprocess.PIPE)
#             print(OutPictures)
#         go()
#             # while True:
#             #     sleep(60)
#         # p2=Process(target=go(),args=())
#         # p2.start()
#         # t=threading.Thread(go())
#         # t.start()
#     return "200"
#
# if __name__ == '__main__':
#     api.run(port=6000,debug=True,host='127.0.0.1')